# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Contributor: Patrick McCarty <pnorcks at gmail dot com>
# Contributor: Fernando Munoz <f[at]beford.net>
# Contributor: Alexandre Bique <bique.alexandre[at]gmail.com>

pkgbase=isomd5sum
pkgname=('isomd5sum' 'python-isomd5sum')
pkgver=1.2.3
pkgrel=8
arch=('loong64' 'x86_64')
license=('GPL')
makedepends=('popt' 'python')
url='https://github.com/rhinstaller/isomd5sum'
source=("$pkgbase-$pkgver.tar.gz::https://github.com/rhinstaller/isomd5sum/archive/$pkgver.tar.gz")
options=('!emptydirs')
sha512sums=('a500faa368377c8fb5dfc311bc3a6dbadd253e6af7928b691d1fc11e25b69819a611f72fa201e70f5df257cdc491c97d1f612bb179fa49de1fb0a638d6ac7972')

prepare() {
  sed -i -e 's/^\(LIBDIR = \)lib64/\1lib/' $pkgbase-$pkgver/Makefile
}

build() {
  cd $pkgbase-$pkgver
  CFLAGS+=' -ffat-lto-objects' \
  make all
}

package_isomd5sum() {
  depends=('popt')
  pkgdesc="Utilities for working with md5sum implanted in ISO images"

  cd $pkgbase-$pkgver
  make DESTDIR="$pkgdir" install-bin install-devel
}

package_python-isomd5sum() {
  depends=('python')
  pkgdesc="Python3 bindings for isomd5sum"

  cd $pkgbase-$pkgver
  make DESTDIR="$pkgdir" install-python
}
